﻿<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_header :: common_header(~{::title},~{::link},~{})">
    <title>上传记录</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
    上传记录<a class="btn btn-success radius r"
           style="line-height: 1.6em; margin-top: 3px"
           href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="text-c">
        上传时间： <input type="text"
                     onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'timeEnd\')}' })"
                     id="timeStart" class="input-text Wdate" style="width: 120px;"></input>
        至 <input type="text"
                 onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'timeStart\')}' })"
                 id="timeEnd" class="input-text Wdate" style="width: 120px;"></input>
        <input
                type="text" name="serialNo" id="serialNo" placeholder="黑匣子编码-精确查询"
                style="width: 150px" class="input-text"></input>
        <span
                class="select-box" style="width: 150px"> <select
                class="select" name="deviceType" id="deviceType">
					<option value="">请选择类型</option>
					<option th:each="dt:${deviceTypes}"
                            th:value="${dt.key}" th:text="${dt.value}"></option>
			</select>
			</span>
        <button name="" id="" class="btn btn-success" onclick="Search()">
            <i class="Hui-iconfont">&#xe665;</i> 查询
        </button>

        <button onclick="removeIframe()" class="btn btn-primary radius">关闭</button>
    </div>
    <div class="mt-20">
        <table
                class="table table-border table-bordered table-bg table-hover table-sort table-responsive"
                id="dataGrid">
        </table>
    </div>
</div>
<div th:replace="_list_footer :: foot"></div>
<script type="text/javascript">
    $(function () {
        //初始数据
        initDataGrid();
    })

    function initDataGrid() {
        $("#dataGrid").bootstrapTable({
            method: "GET",
            contentType: "application/x-www-form-urlencoded",
            dataType: "json",
            url: '../uploadRecord/uploadRecordList',
            queryParams: queryParams,
            queryParamsType: '',
            pagination: true,//显示分页条页码
            striped: true,//隔行变色
            pageNumber: 1,//首页页码
            pageSize: 10,//每页数据条数
            uniqueId: "uploadRecordId",
            sidePagination: "server",//在服务器分页
            toolbar: "#toolbar",//工具栏
            columns: [{
                title: "上传时间",
                field: "uploadTimeStr",
                width: 150
            }, {
                title: "项目名称",
                field: "programName",
                class: 'colStyle',
                width: 120
            }, {
                title: "设备类型",
                field: "deviceType",
                width: 80,
                formatter: deviceTypeFormatter
            }, {
                title: "黑匣子编码",
                field: "serialNo",
                width: 120
            }, {
                title: "上传信息",
                field: "uploadInfo",
                class: 'colStyle',
                formatter: paramsMatter
            }]

        });
    }

    function deviceTypeFormatter(value, row, index) {
        var buttonShow = "";
        if (value == "01") {
            buttonShow = "<span class=\"label radius\">升降机</span>";
        } else if (value == "02") {
            buttonShow = "<span class=\"label label-fail radius\">塔吊</span>";
        } else if (value == "03") {
            buttonShow = "<span class=\"label label-success radius\">环境监测</span>";
        } else if (value == "04") {
            buttonShow = "<span class=\"label label-success radius\">考勤</span>";
        } else if (value == "05") {
            buttonShow = "<span class=\"label label-success radius\">监控</span>";
        }
        return buttonShow;
    }

    /*  鼠标划过显示隐藏内容 */
    function paramsMatter(value, row, index) {
        if (value) {
            var span = document.createElement('span');
            span.setAttribute('title', value);
            span.innerHTML = value;
            return span.outerHTML;
        }
    }

    function queryParams(params) {
        var param = {
            rows: params.limit,
            sort: params.sort,
            sortOrder: params.order,
            offset: params.offset,
            pageSize: params.pageSize,
            pageNum: params.pageNumber,
            serialNo: $("#serialNo").val(),
            deviceType: $("#deviceType").val(),
            timeStart: $("#timeStart").val(),
            timeEnd: $("#timeEnd").val()
        };

        return param;
    }

    //查询
    function Search() {
        $('#dataGrid').bootstrapTable('refresh');
    }
</script>
</body>
</html>